import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:xm_app/common/logger/LoggerUtil.dart';
import 'package:xm_app/model/VodDetails.dart';
import 'package:xm_app/page/play/PlayController.dart';
import 'package:xm_app/page/play/widget/MyVideo.dart';
import 'package:xm_app/widget/PlayListWidget.dart';

class PlayPage extends GetView<PlayController> {
  @override
  Widget build(BuildContext context) {
    return GetBuilder<PlayController>(
        init: PlayController(),
        builder: (_) {
          return Scaffold(
            backgroundColor: Colors.black,
            body: SafeArea(
              child: Container(
                color: Colors.white,
                child: Column(
                  children: [
                    MyVideo(
                        playName: controller.vod.vodName,
                        playUrl: controller.vod.vodPlayUrls[controller.vod.vodPlayServer[controller.fromIndex].from][controller.index][1]),
                    Expanded(
                        child: SingleChildScrollView(
                      physics: BouncingScrollPhysics(),
                      child: Padding(
                        padding: EdgeInsets.all(15),
                        child: PlayListWidget(
                          vod: controller.vod,
                          itemOnTap: (fromIndex, index) => controller.changeVideo(fromIndex, index),
                          tabOnTap: (fromIndex, index) => controller.changeVideo(fromIndex, index),
                          showType: 1,
                          itemIndex: controller.index,
                          fromIndex: controller.fromIndex,
                          isPlay: true,
                        ),
                      ),
                    )),
                  ],
                ),
              ),
            ),
          );
        });
  }
}
